import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace OrderCustomerApi {
  /** SPA订单客户关联信息 */
  export interface OrderCustomer {
    id: number; // 主键ID
    orderId?: number; // 关联spa_order表ID
    orderExtensionId?: number; // 关联spa_order_extension表ID
    customerId?: number; // 客户ID
    customerType: string; // 客户类型
    customerName?: string; // 客户姓名
    customerPhone: string; // 客户电话
    customerAge: number; // 客户年龄
    customerGender: string; // 客户性别
    specialRequirements: string; // 特殊要求
    healthNotes: string; // 健康备注
    allergies: string; // 过敏信息JSON
    preferences: string; // 偏好设置JSON
    scope: string; // 权限范围
    scoperef: string; // 权限引用
    customerRelationship: string; // 与主客户关系
    emergencyContact: string; // 紧急联系人
    emergencyPhone: string; // 紧急联系电话
    medicalHistory: string; // 病史记录
    currentMedications: string; // 当前用药情况
    dietaryRestrictions: string; // 饮食限制
    accessibilityNeeds: string; // 无障碍需求
  }
}

/** 查询SPA订单客户关联分页 */
export function getOrderCustomerPage(params: PageParam) {
  return requestClient.get<PageResult<OrderCustomerApi.OrderCustomer>>('/spa/order-customer/page', { params });
}

/** 查询SPA订单客户关联详情 */
export function getOrderCustomer(id: number) {
  return requestClient.get<OrderCustomerApi.OrderCustomer>(`/spa/order-customer/get?id=${id}`);
}

/** 新增SPA订单客户关联 */
export function createOrderCustomer(data: OrderCustomerApi.OrderCustomer) {
  return requestClient.post('/spa/order-customer/create', data);
}

/** 修改SPA订单客户关联 */
export function updateOrderCustomer(data: OrderCustomerApi.OrderCustomer) {
  return requestClient.put('/spa/order-customer/update', data);
}

/** 删除SPA订单客户关联 */
export function deleteOrderCustomer(id: number) {
  return requestClient.delete(`/spa/order-customer/delete?id=${id}`);
}


/** 导出SPA订单客户关联 */
export function exportOrderCustomer(params: any) {
  return requestClient.download('/spa/order-customer/export-excel', { params });
}

